*********************************************************************************
* Table 2, Table 3, Figure 4													*
*********************************************************************************

* Project: 	Stability of national identity
* Authors: 	Matthias Mader
* Date:		Feb 2023

*********************************************************************************


*** Setup

	set more off            					// Disable partitioned output
	set dp period								// Use comma instead of dot for decimals
	set linesize 80         					// Line size limit to make output more readable
	macro drop _all         					// clear all macros
	set scheme cleanplots						// set graph scheme
	graph set window fontface "Times New Roman" // set font 


*** Open data set
	use "DATA_clean.dta", clear

	drop if ethnic21_cat1 == . | ///
	ethnic32_cat1 == . | ///
	ethnic43_cat1 == . | ///
	ethnic41_cat1 == . | ///
	civic21_cat1 ==. | ///
	civic32_cat1 == . | ///
	civic43_cat1 == . | ///
	civic41_cat1 == . | ///
	id21_cat1 == . | ///
	id32_cat1 == . | ///
	id43_cat1 == . | ///
	id41_cat1 == . | ///
	rwa21_cat1 == . | ///
	rwa32_cat1 == . | ///
	rwa43_cat1 == . | ///
	rwa41_cat1 == .

fre ethnic32_cat1 rwa43_cat1 // Check N
fre ethnic32_cat1 rwa43_cat1 [aw = wei5_mz] 



** Table 2: Individual-level stability of national identity content
	fre ethnic21_cat1 ethnic32_cat1 ethnic43_cat1 ethnic41_cat1 [aw = wei5_mz]  // column 1-4
	fre civic21_cat1 civic32_cat1 civic43_cat1 civic41_cat1 [aw = wei5_mz] 	 // column 5-8



*** Table 3: Individual-level stability of national identification and right-wing authoritarianism
	fre id21_cat1 id32_cat1 id43_cat1 id41_cat1	[aw = wei5_mz] 				 // column 1-4
	fre rwa21_cat1 rwa32_cat1 rwa43_cat1 rwa41_cat1	[aw = wei5_mz] 			 // column 5-8



*** Text ("The average score of the ethnic measure is 1.8 (SD=1.3; 10th percentile=0.3; 90th percentile=3.7), for the civic measure it is 1.3 (SD=1.3; 10th percentile=0.3; 90th percentile=2.7). ")
	sum ethnic_abs civic_abs [aw = wei5_mz] , det



*** Figure 4: Sum of absolute intra-individual change, 2016-2021

gen ethnic_abs_r = round(ethnic_abs, 1)
gen civic_abs_r = round(civic_abs, 1)
gen id_abs_r = round(id_abs, 1)
gen rwa_abs_r = round(rwa_abs, 1)


	hist ethnic_abs_r, discrete percent  ///
			name(h1, replace) ///
			yscale(range(0 50)) ylabel(0(10)50, labsize(huge)) ytitle("Percent", size(huge)) ///
			xscale(range(0 12)) xlabel(0(1)12, labsize(huge)) xtitle(" ") ///
			title("Ethnic dimension", size(huge)) ///
			xsize(3) ysize(2) graphregion(margin(0 2 -9 0))

	hist civic_abs_r, discrete percent  ///
			name(h2, replace) ///
			yscale(range(0 50)) ylabel(0(10)50, labsize(huge)) ytitle("Percent", size(huge)) ///
			xscale(range(0 12)) xlabel(0(1)12, labsize(huge)) xtitle(" ") ///
			title("Civic dimension", size(huge)) ///
			xsize(3) ysize(2) graphregion(margin(0 2 -9 0))

	hist id_abs_r, discrete percent  ///
			name(h3, replace) ///
			yscale(range(0 50)) ylabel(0(10)50, labsize(huge)) ytitle("Percent", size(huge)) ///
			xscale(range(0 12)) xlabel(0(1)12, labsize(huge)) xtitle(" ") ///
			title("National identification", size(huge)) ///
			xsize(3) ysize(2) graphregion(margin(0 2 -9 0))

	hist rwa_abs_r, discrete percent  ///
			name(h4, replace)  ///
			yscale(range(0 50)) ylabel(0(10)50, labsize(huge)) ytitle("Percent", size(huge)) ///
			xscale(range(0 12)) xlabel(0(1)12, labsize(huge)) xtitle(" ") ///
			title("RWA", size(huge)) ///
			xsize(3) ysize(2) graphregion(margin(0 2 -9 0))

